home *** CD-ROM | disk | FTP | other *** search
/ AM/FM: Amiga Musicians' Freeware Magazine 16 / AM-FM 16.adf / text / ARexx&OctaMED.txt.pp / ARexx&OctaMED.txt (.png)
ANSI Art File  |  1991-03-01  |  8KB  |  640x3088
Labels: text | screenshot | font
OCR: AM/FM ARexx and OctaMED An exploration of multi-tasking For multimedia applications An Article written for AM/FM by Gareth R. Craft In 1991, the Amiga won the European Home Computer of the Year' award. Its superior Graphic users Interface, multi-tasking, and impressive graphic and sound abilities have brought a new level of computing power to the 'home' user. Now, one thing that everybody expects from any personal computer is the ability to offer control and automation over all its tasks. This was true even when home computers were paltry affairs by today's standards. As users become less dazzled by the abilities of the machine, they become more intrested in how to use it practically themselves. This shift from passive to a more active style of home computing stresses the need for a personal programming language for the Amiga. The lay person could well be excused for thinking that such a language should come automatically with the computer. In an ideal world that may be the case, but in reality, good software always takes time to follow the hardware. For many reasons, neither AmigaBASIC nor AmigaODS ever became popular for personal programming. A substantial vacuum existed in this area. That was until the long awaited release of Workbench 2.0 on the Amiga which introduced a new contender in the personal programming language stakes Arexx. ARexx is derived from the REXX language used on the big computers for script control and interprocess communication. It was implemented on the Amiga by Bill Hawes, a programmer with some impressive programs to his name It is generally agreed that the implementation is extremely sound, and that it takes special advantage of the Amiga's features. ARexx is not a new language, and has had something of a cult following for quite a while, especially among US are 200 However, once its programmers. to super-practical nature started become apparent, more and more people became interested. Today, many serious applications have ARexx support and Teijo Kinunen's OctaMED is a good example where multi-tasking and multi-media follow this new ARexx tradition. What follows is a discussion of some of the ARexx Commands and writing an ARexx script for the OctaMEDPlayer and multi-tasking. The ARexx ADDRESS instruction, which has a number of forms including 'address COMMAND' is the method used to communicate with the underlying AmigaDOS by setting up an ARexx host address. e.g. use If we have OctaMEDPlayer in df0: we can run the program. ARexx to ask AmigaDOS to load and /* Music Example.rexx */ address command run df0:OCTAMEDPLAYER' say loading OCTAMEDPLAYER Program' Now in order to send some messages from ARexx to our host address OctaMEdPlayer, this port must actually exist, and due to the time taken for AmigaDOS to load and run a program it is necessary to instruct ARexx via a script to wait until this program has started. The ARexx 'WaitForPort' instruction is used for this purpose, asking ARexx to run the WaitForPort utility and wait for OctaMEDPlayer to set up its communication port... address command 'WaitForPort OCTAMEDPLAYER Once the port is found and the ARexx script ARexx's current host address to OCTAMEDPLAYER ADDRESS instruction... reawakens, it is possible to set using the following form of address 'OCTAMEDPLAYER' /* Speak to Player' / We could for example create an ARexx script to load up a module, play it for a while, stop it, diplay some kind of closing down message and OctaMeDPlayer. the quit /* Music Example 1.rexx */ address command 'run df0:OctaMEDPlayer' say loading OctaMEDPlayer program' address command 'WaitForPort' OCTAMEDPLAYER address 'OCTAMEDPLAYER 'Loadmod df0: mysong' /* Speak to the Player */ /* load specified song */ /* Start Playing Play' Call Delay (20 * 50) 'Stop' /* Play for 20 Seconds */ /* Stop Playing */ Program' Say 'Closing down OctaMEDPlayer 'quit' /* Shut Down PLayer */ Note:- LOADMOD, PLAY, STOP and QUIT are not ARexx commands but are in fact instructions implemented by the programmer in the OctaMEDP layer interface. Since the above script contains the ARexx delay() function, it is necessary to install the "rexxsupport.library" before it is run. Typing in the at the prompt in the AmigaDOS Shell:- RXLIB rexxsupport.library 0 -30 0 will preload it for us. Alternatively we can ammend the script to check for and install the library accordingly. * Music Example 2.rexx' */ If "Show('L','rexxsupport.library') then do Say 'adding rexxsupport library' Call AddLib('rexxsupport.library',0,30,0) end address Command 'run df0:OctaMedPlayer' Say 'Loading OctaMEDPLayer Program' address command 'WaitForPort OCTAMEDPLAYER' address 'OCTAMEDPLAYER' 'loadmod df0: mysong' 'play' delay (20 * 50) Stop Call Talk to the Player */ Load the specified song */ /* Start Playing */ /* Play for 20 seconds */ /* Stop Playing */ Program' /*Shut down the Player */ say 'Closing down OctaMEDPlayer 'quit' ARexx scripts normally tend to do more difficult jobs and so need rather more error checking code. What is not apparent in this example is in fact that often the result of the ARexx involvement will be that the combined power of the various parts of an application is actually greater thean the individual components. With a little modification our example script could be made to control the OctaMEDPlayer at the sametime as controlled an IFF picture display generated by another ARexx controllable program - the net result then would be an integrated sound/visual multimedia type presentation that neither program could have acheived on its own. Gareth R.Craft. Further Reading ARexx Programming on the Amiga by Chris Zamara Published by Abacus Price ú30 Using ARexx on the Amiga Published by DTBS Books Price ú29.95 The ARexx Language: The Practice Approach to Programming By M.F. Conlishan ISBN No. 1-3-7806521-1 Price ú40 ARexx Manual on 3.5 inch DD Floppy Disk By L.S.D Price ú1.25p + ú1 Postage & Packing Cheques and International Post orders made payable to Gareth R. Craft ARexx Manual on Disk Available from MicroCraft PD 12 Mount Road Halton Runcorn Cheshire. WA? ZBH. England. U.K. Tel: +44 0928 563762 AM/FM